
$(document).ready(function() {
    $("#feature input:checkbox").each(function(){
		$(this).click(function(){
			var rel = $(this).attr('rel');
			var tmp = rel.split("_");
			var flag;
			if(tmp[1] == 'on')
			{
				$("#on_"+tmp[0]).attr({"checked": "checked"});
				$("#off_"+tmp[0]).removeAttr("checked");
				flag = 1;
			}
			else{
				$("#off_"+tmp[0]).attr({"checked": "checked"});
				$("#on_"+tmp[0]).removeAttr("checked");
				flag = 0;
			}
			$.ajax({
				url:"ajax.php",
				type:"post",
				data: ({
					imei: $("#command_imei").text(),	
					flag: flag,
					kind: tmp[0],
				}),
				success: function(msg){
					location.reload();
				}
					
			});
		});
	});
});
